<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>系统日志</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
    <style type="text/css">
        .search-container .layui-form-select, .search-container input[type=text] {
            width: 212px!important;
        }
    </style>
</head><body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/log/event/system/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">类&emsp;&emsp;名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="callerClass" autocomplete="off" class="layui-input"
                                           value="${logEventQuery.callerClass}" placeholder="类名">
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">方法名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="callerMethod" autocomplete="off" class="layui-input"
                                           value="${logEventQuery.callerMethod}" placeholder="方法名称">
                                </div>
                            </li>
                            <%--<li class="form-item-inline"><label class="search-form-lable">行数</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="callerLine" autocomplete="off" class="layui-input"
                                           value="${logEventQuery.callerLine}" placeholder="行数">
                                </div>
                            </li>--%>
                            <li class="form-item-inline"><label class="search-form-lable">级别</label>
                                <div class="layui-input-inline">
                                    <select name="levelString">
                                        <option value="">全部</option>
                                        <option value="INFO"
                                                <c:if test="${logEventQuery.levelString == 'INFO'}">selected</c:if>>INFO
                                        </option>
                                        <option value="ERROR"
                                                <c:if test="${logEventQuery.levelString == 'ERROR'}">selected</c:if>>ERROR
                                        </option>
                                    </select>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">项目名称</label>
                                <div class="check-btn-inner">
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),'','#myForm')" ${empty projectType || projectType == '' ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),'admin','#myForm')" ${projectType == 'admin' ? 'class="active"' : ''}>admin</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),'web','#myForm')" ${projectType == 'web' ? 'class="active"' : ''}>web</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),'mobile','#myForm')" ${projectType == 'mobile' ? 'class="active"' : ''}>mobile</a>
                                    <input type="hidden" name="projectType" value="${projectType}"/>
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">日志内容</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="formattedMessage" autocomplete="off" class="layui-input"
                                           value="${logEventQuery.formattedMessage}" placeholder="日志内容">
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">时&emsp;&emsp;间</label>
                                <div class="check-btn-inner">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty logEventQuery.timeType || logEventQuery.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${logEventQuery.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${logEventQuery.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${logEventQuery.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${logEventQuery.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${logEventQuery.createStart}" placeholder="开始日"

                                        >
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${logEventQuery.createEnd}" placeholder="截止日"

                                        >
                                    </div>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content">
                <div class="cl">
                    <table class="layui-table">
                        <colgroup>
                            <col>
                            <col width="20%">
                            <col width="10%">
                            <col width="10%">
                            <col width="16%">
                            <col width="10%">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>类名</th>
                            <th>方法名称</th>
                            <th>行数</th>
                            <th>级别</th>
                            <th>时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="log" items="${list}">
                            <tr>
                                <td class="">
                                    <div class="ellipsis-1" title="${log.callerClass}">${log.callerClass}</div>
                                </td>
                                <td>
                                        ${log.callerMethod}
                                </td>
                                <td>
                                        ${log.callerLine}
                                </td>
                                <td>
                                        ${log.levelString}
                                </td>
                                <td>
                                    <fmt:formatDate value="${log.timestmp}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                </td>
                                <td class="tb-opts">
                                    <div class="comm-opts">
                                        <a href="javascript:openDialogShow('详细信息','${ctx}/log/event/get.do?id=${log.eventId}','1050px','500px')"
                                           target="_self">
                                            详细信息
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div>
    </section><!--底部-->
    <%@include file="../include/footer.jsp" %>
</div>



<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
//加载分页
        loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });
    })

</script>
<script type="text/javascript">
    txz.initHeader({
        nav:[{
            name: '系统日志',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>'
    });
</script>
</body>
</html>